<?php

use App\Http\Controllers\Api\V1\AuthController;
use App\Http\Controllers\Api\V1\FeedbackController;
use App\Http\Controllers\Api\V1\JobpositionController;
use App\Http\Controllers\Api\V1\PageController;
use App\Http\Controllers\Api\V1\PlazaController;
use App\Http\Controllers\Api\V1\SignUpController;
use App\Http\Controllers\Api\V1\SmsController;
use App\Http\Controllers\Api\V1\SystemController;
use App\Http\Controllers\Api\V1\UserController;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\Api\V1\SearchController;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/
Route::prefix('v1')
//    ->domain(config('app.api_url'))
    ->namespace('App\Http\Controllers\Api\V1')
    ->name('api.v1.')
    ->group(function () {
        Route::middleware('throttle:' . config('api.rate_limits.sign'))
            ->group(function () {
                //首页
                Route::post("home/index", [PageController::class, 'index'])->name('page.index');
                // 登录
                Route::post('/auth/login-init', [AuthController::class, 'loginInit']);
                Route::post('/auth/login', [AuthController::class, 'login'])->name('login');
                //友盟一键登录
                Route::post('auth/fast-login', [AuthController::class, 'oneclickLogin']);
                // 刷新Token
                Route::post('auth/refresh', [AuthController::class, 'refresh']);
                // 短信验证码
                Route::post('sms/code', [SmsController::class, 'send'])->name('sms.send');
                //职位列表
                Route::post('jobposition/index', [JobpositionController::class, 'index']);
                //职位详情
                Route::post('jobposition/detail', [JobpositionController::class, 'detail']);
                //广场轮播图
                Route::post('plaza/banner-list', [PlazaController::class, 'bannerLists']);
                //广场列表
                Route::post('plaza/list', [PlazaController::class, 'index']);
                //专区列表
                Route::post('plaza/area-list', [PlazaController::class, 'areaList']);
                //职位推荐列表
                Route::post('recommend-list', [JobpositionController::class, 'recommendList']);
                //我要招人
                Route::post('page/recruit', [PageController::class, 'recruit']);
                //联系我们
                Route::post('page/contact', [PageController::class, 'contact']);
                //上传图片
                Route::post('system/uploads', [SystemController::class, 'uploadImages']);
                //搜索历史
                Route::post('search-records', [SearchController::class, 'index']);
                

            });
        /// 一下接口登录后方可访问
        Route::middleware('throttle:' . config('api.rate_limits.access'))
            ->group(function () {
                Route::middleware(\App\Http\Middleware\AuthApi::class)->group(function () {
                    //获取用户的信息
                    Route::post('auth/me', [AuthController::class, 'me']);
                    //注销账户
                    Route::post('auth/unsubscribe', [AuthController::class, 'unsubscribe']);
                    // 退出登陆
                    Route::post('auth/logout', [AuthController::class, 'logout']);


                    //简历信息
                    Route::post('user/resume-info', [UserController::class, 'resumeInfo']);
                    //快捷修改个人简历
                    Route::post('user/update-resume', [UserController::class, 'updateResume']);
                    //修改个人描述
                    Route::post('user/update-description', [UserController::class, 'updateDescription']);
                    //修改教育经历
                    Route::post('user/update-education', [UserController::class, 'updateEducation']);
                    
                    //添加工作经历
                    Route::post('user/add-work-experience', [UserController::class, 'addWorkExperience']);

                    //修改工作经历
                    Route::post('user/update-work-experience', [UserController::class, 'updateWorkExperience']);

                    //删除工作经历
                    Route::post('user/del-work-experience', [UserController::class, 'delWorkExperience']);


                    //修改手机号
                    Route::post('user/edit-mobile', [UserController::class, 'editMobile']);
                    //上传头像
                    Route::post('user/update-avatar', [UserController::class, 'updateAvatar']);

                    //职位报名
                    Route::post('jobposition/sign-up', [JobpositionController::class, 'signUp']);
                    //增加聊天内容
                    Route::post('jobposition/contact', [JobpositionController::class, 'message']);
                    //客服消息
                    Route::post('customer-service-message', [JobpositionController::class, 'customerServiceMessage']);

                    //收藏职位
                    Route::post('collect', [JobpositionController::class, 'collect']);
                    //收藏列表
                    Route::post('collect-list', [JobpositionController::class, 'collectList']);
                    //取消收藏
                    Route::post('collect-cancel', [JobpositionController::class, 'collectCancel']);
                    //我的报名
                    Route::post('sing-up/list', [SignUpController::class, 'index']);
                    //报名详情
                    Route::post('sing-up/detail', [SignUpController::class, 'detail']);
                    
                    //点赞职位
                    Route::post('jobthumbsup', [JobpositionController::class, 'jobthumbsup']);
                    //取消点赞职位
                    Route::post('jobthumbsup_cancel', [JobpositionController::class, 'jobthumbsup_cancel']);


                    //删除搜索记录
                    Route::post('search-delete', [SearchController::class, 'delete']);
                    //反馈初始化
                    Route::post('feedback/init', [FeedbackController::class, 'init']);
                    //反馈提交
                    Route::post('feedback/create', [FeedbackController::class, 'create']);
                    //反馈列表
                    Route::post('feedback/lists', [FeedbackController::class, 'lists']);


                });
            });
    });
